//
//  SeJueSelectTestTypeViewController.m
//  安好
//
//  Created by qinlongqing on 14-9-13.
//  Copyright (c) 2014年 冯凯. All rights reserved.
//

#import "SeJueSelectTestTypeViewController.h"
#import "SeJueShuZiTestViewController.h"

@interface SeJueSelectTestTypeViewController ()
{
    CGFloat selectTypeHeight;
    CGFloat tiShiHeight;
}
@end

@implementation SeJueSelectTestTypeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"色觉";
    
    self.view.backgroundColor = UIColorFromRGB(0xe7f1f4);
    
    [self makeNavBar];
    
    if (kScreenWidth == 414) {
        selectTypeHeight = 134;
        tiShiHeight = 120;
    }
    else{
        selectTypeHeight = 112;
        tiShiHeight = 100;
    }
    CGFloat spaceOfToCircle_half = ((kScreenHeight - selectTypeHeight*2 - tiShiHeight - 64)/6 + selectTypeHeight)/3*sqrtf(3.0);//屏幕中心到左边圆心的距离
    CGFloat space = (kScreenHeight - selectTypeHeight*2 - tiShiHeight - 64)/4;
    
    
    UIButton *shuZiTestBTN = [[UIButton alloc]init];
    shuZiTestBTN.frame = CGRectMake((kScreenWidth - selectTypeHeight)/2, space, selectTypeHeight, selectTypeHeight);
    [shuZiTestBTN setBackgroundImage:[UIImage imageNamed:@"se_jue_ce_shi_type_select3"] forState:UIControlStateNormal];
    
    [shuZiTestBTN setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    if (kScreenWidth == 414) {
        shuZiTestBTN.titleLabel.font = [UIFont systemFontOfSize:20];
    }
    else{
        shuZiTestBTN.titleLabel.font = [UIFont systemFontOfSize:18];
    }
    [shuZiTestBTN setTitle:@"数字测试" forState:UIControlStateNormal];
    [shuZiTestBTN addTarget:self action:@selector(doShuZiTestBTN) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:shuZiTestBTN];
    
    UIButton *tuXingTestBTN = [[UIButton alloc]init];
    tuXingTestBTN.frame = CGRectMake(kScreenWidth/2 - spaceOfToCircle_half - selectTypeHeight/2, shuZiTestBTN.frame.origin.y + shuZiTestBTN.frame.size.height + space*2/3, selectTypeHeight, selectTypeHeight);
    [tuXingTestBTN setBackgroundImage:[UIImage imageNamed:@"se_jue_ce_shi_type_select2"] forState:UIControlStateNormal];
    [tuXingTestBTN setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    if (kScreenWidth == 414) {
        tuXingTestBTN.titleLabel.font = [UIFont systemFontOfSize:20];
    }
    else{
        tuXingTestBTN.titleLabel.font = [UIFont systemFontOfSize:18];
    }
    [tuXingTestBTN setTitle:@"图形测试" forState:UIControlStateNormal];
    [tuXingTestBTN addTarget:self action:@selector(doTuXingTestBTN) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:tuXingTestBTN];
    
    UIButton *zuHeTestBTN = [[UIButton alloc]init];
    zuHeTestBTN.frame = CGRectMake(kScreenWidth/2 + spaceOfToCircle_half - selectTypeHeight/2, shuZiTestBTN.frame.origin.y + shuZiTestBTN.frame.size.height + space*2/3, selectTypeHeight, selectTypeHeight);
    [zuHeTestBTN setBackgroundImage:[UIImage imageNamed:@"se_jue_ce_shi_type_select1"] forState:UIControlStateNormal];
    [zuHeTestBTN setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    if (kScreenWidth == 414) {
        zuHeTestBTN.titleLabel.font = [UIFont systemFontOfSize:20];
    }
    else{
        zuHeTestBTN.titleLabel.font = [UIFont systemFontOfSize:18];
    }
    [zuHeTestBTN setTitle:@"组合测试" forState:UIControlStateNormal];
    [zuHeTestBTN addTarget:self action:@selector(doZuHeTestBTN) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:zuHeTestBTN];
    
    
    UIImageView *tiShiBG = [[UIImageView alloc]init];
    tiShiBG.frame = CGRectMake(0, kScreenHeight - 64 - tiShiHeight, kScreenWidth, tiShiHeight);
    tiShiBG.image = [UIImage imageNamed:@"test_result_fen_xiang_bg"];
    [self.view addSubview:tiShiBG];
    
    UILabel *wenXinTiShiLabel = [[UILabel alloc]init];
    if (kScreenWidth == 414) {
        wenXinTiShiLabel.frame = CGRectMake(32, 36, 120, 18);
        wenXinTiShiLabel.font = [UIFont systemFontOfSize:14];
    }
    else{
        wenXinTiShiLabel.frame = CGRectMake(27, 30, 100, 15);
        wenXinTiShiLabel.font = [UIFont systemFontOfSize:12];
    }
    wenXinTiShiLabel.textAlignment = NSTextAlignmentLeft;
    wenXinTiShiLabel.textColor = UIColorFromRGB(0x4fc1e9);
    wenXinTiShiLabel.text = @"温馨小提示";
    wenXinTiShiLabel.backgroundColor = [UIColor clearColor];
    [tiShiBG addSubview:wenXinTiShiLabel];

    UILabel *tiShiLabel = [[UILabel alloc]init];
    if (kScreenWidth == 414) {
        tiShiLabel.frame = CGRectMake(60, 60, kScreenWidth - 60, 25);
        tiShiLabel.font = [UIFont systemFontOfSize:14];
    }
    else{
        tiShiLabel.frame = CGRectMake(50, 50, kScreenWidth - 50, 20);
        tiShiLabel.font = [UIFont systemFontOfSize:12];
    }
    tiShiLabel.textAlignment = NSTextAlignmentLeft;
    tiShiLabel.textColor = UIColorFromRGB(0x4fc1e9);
    tiShiLabel.text = @"请认真对待该测试，否则可能会导致结果不准确!";
    tiShiLabel.backgroundColor = [UIColor clearColor];
    [tiShiBG addSubview:tiShiLabel];

}

- (void)makeNavBar{
    UIBarButtonItem *backBtnImg = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"公用_返回.png"] style:UIBarButtonItemStylePlain target:self action:@selector(doBack)];
    [backBtnImg setTintColor:[UIColor whiteColor]];
    self.navigationItem.leftBarButtonItem = backBtnImg;
}

-(void)doBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)doShuZiTestBTN{
    SeJueShuZiTestViewController *shuZiTest = [[SeJueShuZiTestViewController alloc]init];
    shuZiTest.seJueTestViewController = self.seJueTestViewController;
    shuZiTest.testWay = shuZiTestWay;
    [self.navigationController pushViewController:shuZiTest animated:YES];
}

- (void)doTuXingTestBTN{
    SeJueShuZiTestViewController *tuXingTest = [[SeJueShuZiTestViewController alloc]init];
    tuXingTest.seJueTestViewController = self.seJueTestViewController;
    tuXingTest.testWay = tuXingTestWay;
    [self.navigationController pushViewController:tuXingTest animated:YES];
}

- (void)doZuHeTestBTN{
    SeJueShuZiTestViewController *hunHeTest = [[SeJueShuZiTestViewController alloc]init];
    hunHeTest.seJueTestViewController = self.seJueTestViewController;
    hunHeTest.testWay = hunHeTestWay;
    [self.navigationController pushViewController:hunHeTest animated:YES];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
